﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Hong.Pan.UI
{
    /// <summary>
    /// Login.xaml 的交互逻辑
    /// </summary>
    public partial class Login : Window
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public Login()
        {
            InitializeComponent();
            //myWebBrowser.Source = new Uri("https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=" + App.client_id + "&redirect_uri=oob&scope=basic,netdisk&login_type=sms");
            //myWebBrowser.Navigate("https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=" + Baidu.Config.client_id + "&redirect_uri=oob&scope=basic,netdisk&login_type=sms");
        }
        /** 浏览地址变更页面加载完成 */
        private void myWebBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            Debug.WriteLine($"LoadCompleted {e.Uri.OriginalString}");

            /*
            Baidu.Login baiduLogin = new Baidu.Login();
            if (baiduLogin.loginEnd(e.Uri.OriginalString)) {
                //Debug.WriteLine(json);

                MainWindow main = new MainWindow();
                main.Show();

                this.Close();
            }*/
        }
    }
}
